package com.gylang.pdf;

import freemarker.template.Template;
import freemarker.template.TemplateException;

import java.io.IOException;
import java.io.Reader;
import java.util.Locale;

/**
 * pdf模板渲染处理器
 * @author gylang
 * data 2022/1/14
 */
public class PdfTemplateRenderProcessor extends PdfRenderProcessor implements ITemplateProcessor {

    private ITemplateProcessor templateProcessor;


    @Override
    public Template getTemplate(String name) throws IOException {
        return templateProcessor.getTemplate(name);
    }

    @Override
    public Template getTemplate(String name, Locale locale) throws IOException {
        return templateProcessor.getTemplate(name, locale);
    }

    @Override
    public Template getTemplate(String name, Locale locale, String encode) throws IOException {
        return templateProcessor.getTemplate(name, locale, encode);
    }

    @Override
    public Template getTemplate(String name, Locale locale, String encode, boolean parseAsFTL) throws IOException {
        return templateProcessor.getTemplate(name, locale, encode, parseAsFTL);
    }

    @Override
    public Template getTemplate(String name, Locale locale, String encode, boolean parseAsFTL, boolean ignoreMissing) throws IOException {
        return templateProcessor.getTemplate(name, locale, encode, parseAsFTL, ignoreMissing);
    }

    @Override
    public Template createTemplate(String name, String source) throws IOException {
        return templateProcessor.createTemplate(name, source);
    }

    @Override
    public Template createTemplate(String name, Reader reader, String encode) throws IOException {
        return templateProcessor.createTemplate(name, reader, encode);
    }

    @Override
    public Template pushTemplate(String name, String source) throws IOException {
        return templateProcessor.pushTemplate(name, source);
    }

    @Override
    public boolean removeTemplate(String name) {
        return templateProcessor.removeTemplate(name);
    }

    @Override
    public String render(String name, Object obj) throws IOException, TemplateException {
        return templateProcessor.render(name, obj);
    }

    @Override
    public String render(String name, String templateSource, Object obj) throws IOException, TemplateException {
        return templateProcessor.render(name, templateSource, obj);
    }

    public void setTemplateProcessor(ITemplateProcessor templateProcessor) {
        this.templateProcessor = templateProcessor;
    }
}
